#ifndef LINKEDLIST_H
#define LINKEDLIST_H
#include <stdlib.h>
#include "./mempool.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct LinkedListUnit {
  void* data;
  struct LinkedListUnit* prior;
  struct LinkedListUnit* next;
} LinkedListUnitStruct;  //链节结构

typedef struct LinkedList {
  void* id;
  unsigned int length;
  LinkedListUnitStruct* first;
  LinkedListUnitStruct* current;
  LinkedListUnitStruct* last;
} LinkedListStruct;  //链表结构

LinkedListStruct* linkedList_new(void);
LinkedListUnitStruct* linkedList_addData(LinkedListStruct* self, void* data);
void linkedList_delData(LinkedListStruct* self, void* data);
LinkedListUnitStruct* linkedList_findData(LinkedListStruct* self, void* data);

#ifdef __cplusplus
}
#endif
#endif  // LINKEDLIST_H
